<!--
 * @Autor: Charlie/彭旺
 * @email: 413157399@qq.com
 * @Date: 2022-06-21 21:18:09
-->
<template>
  <div class="app-container">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="200px">
      <el-form-item label="积分抵用比例" prop="recommend">
        <el-input class="input-se" v-model="form.recommend" />元
        <!-- <span class="input-tips">积分抵用比例（1个积分抵多少金额）</span> -->
      </el-form-item>
      <el-form-item label="积分释放条件" prop="recommendSuperior">
        <el-input class="input-se" v-model="form.total" />个
        <!-- <span class="input-tips">积分达到多少数量后才可以释放成我的资产</span> -->
      </el-form-item>
      <!-- <el-form-item label="注册者：" prop="registerUser">
        <el-input class="input-se" v-model="form.registerUser" />%
        <span class="input-tips">可用积分按照百分之几进行释放</span>
      </el-form-item> -->
      <el-form-item label="释放比例：" prop="total">
        <el-input class="input-se" v-model="form.recommendSuperior" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
      <h3>积分打赏比例分配：</h3>
       <el-form-item label="被打赏者比例：" prop="total">
        <el-input class="input-se" v-model="form.Berewarded" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
       <el-form-item label="自己分配比例：" prop="total">
        <el-input class="input-se" v-model="form.establish" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
       <el-form-item label="随机视频分发比例：" prop="total">
        <el-input class="input-se" v-model="form.Videoscale" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
       <el-form-item label="系统分销分配比例:" prop="total">
        <el-input class="input-se" v-model="form.Systemdistribution" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
       <el-form-item label="五星会员:" prop="total">
        <el-input class="input-se" v-model="form.menber" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
       <el-form-item label="平台运维:" prop="total">
        <el-input class="input-se" v-model="form.platform" />%
        <!-- <span class="input-tips">可用积分按照百分之几进行释放</span> -->
      </el-form-item>
      
      <!-- <div class="title">积分打赏比例分配：</div> -->
      <el-form-item>
        <el-button class="but" type="primary" @click="doSubmit" :loading="columnLoading">保存</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { add, getQuery } from '@/api/yxGoldenBeanManagement'
export default {
  name: 'Preview',
  data() {
    return {
      form: {},
      rules: {
        recommend: [
          { required: true, message: '请填写积分抵用比例', trigger: 'blur' }
        ],
        total: [{ required: true, message: '请填写积分释放条件数量', trigger: 'blur' }],
        recommendSuperior: [{ required: true, message: '请填写积分释放条件数量', trigger: 'blur' }],
        registerUser: [{ required: true, message: '请填写注册者比例', trigger: 'blur' }],
        Berewarded: [{ required: true, message: '请填写被打赏者比例', trigger: 'blur' }],
        establish: [{ required: true, message: '请填写自己分配比例', trigger: 'blur' }],
        Videoscale: [{ required: true, message: '请填写视频分发比例', trigger: 'blur' }],
        Systemdistribution: [{ required: true, message: '请填写系统分销分配比例', trigger: 'blur' }],
        menber: [{ required: true, message: '五星会员', trigger: 'blur' }],
        platform: [{ required: true, message: '平台运维', trigger: 'blur' }]
      },
      columnLoading: false
    }
  },
  created() {},
  mounted() {
    this.getQueryConfig()
  },
  methods: {
    getQueryConfig() {
      getQuery({ type: 'invitation' })
        .then((res) => {
          if (res.status == '1') {
            this.form = JSON.parse(res.data.configDescribe)
          }
        })
        .catch((err) => {
          console.log(err.response.data.message)
        })
    },
    doSubmit() {
      this.columnLoading = true
      console.log("form",this.form);
      add(this.form)
        .then((res) => {
          console.log("999",res);
          this.notify('保存成功', 'success')
          this.columnLoading = false
          this.getQueryConfig()
        })
        .catch((err) => {
          this.columnLoading = false
          console.log(err.response.data.message)
        })
    }
  }
}
</script>

<style lang="scss" scoped>
.input-se {
  width: 200px;
  margin-right: 15px;
}
.input-tips {
  color: rgb(217, 0, 27);
  font-size: 10px;
  margin-left: 20px;
}
.title {
  width: 200px;
  text-align: right;
  padding-right: 12px;
  line-height: 32px;
  color: #606266;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
}
.but {
  margin-left: 145px;
}
</style>
